Skip to content

Embed the corgea skill in the binary and expose it via corgea skill show - #152

Open
leenk7991 wants to merge 4 commits into
mainfrom
feat/embedded-skill-show
Open

Embed the corgea skill in the binary and expose it via corgea skill show#152
leenk7991 wants to merge 4 commits into
mainfrom
feat/embedded-skill-show

Conversation

@leenk7991

@leenk7991 leenk7991 commented Aug 10, 2026

Copy link
Copy Markdown
Member

Summary

Makes the CLI binary the single source of truth for its own agent skill, per Juan's design: the skills repo points at the CLI rather than keeping a second copy that drifts.

An agent reading the skill from a branch or a registry can be told about flags the installed CLI does not accept. Compiling skills/corgea/SKILL.md into the binary makes the reference pinned to the version being driven, by construction.

  • EMBEDDED_SKILL via include_str!, following the existing pattern in src/vuln_api/mod.rs
  • corgea skill show prints it verbatim to stdout
  • corgea skill install corgea --local writes the same content without touching the registry

Neither path is behind the auth gate. verify_token_and_exit_when_fail still guards the registry install, but reading a string compiled into the binary cannot need a login, and the point is that it still answers when the registry does not. show is dispatched before Config::load() for the same reason — that call creates ~/.corgea/config.toml and panics when it cannot, which made the command exit 101 in a read-only sandbox.

--local refuses any name other than corgea and refuses an explicit @version, since neither is something the binary can honour. The registry path is unchanged and still serves company-authored skills.

This also removes the awkward coupling in the earlier plan: tests/cli_deps_skill.rs and examples/deps_skill.rs hardcode skills/corgea/SKILL.md, and because that file stays put and becomes the embedded artifact, the generated deps block stays authoritative with no cross-repo sync.

Follow-up

Corgea/skills has a stacked PR slimming corgea-scan into a pointer at corgea skill show. It should merge only after this ships in a release, or it points users at a command their binary does not have. Cargo.toml is already at 1.10.0 against a latest tag of v1.9.3, so no version bump is needed.

Test plan

  • cargo fmt --check, cargo clippy --all-targets -- -D warnings clean
  • Full cargo test suite green
  • corgea skill show output is byte-identical to skills/corgea/SKILL.md
  • corgea skill show exits 0 with an unwritable $HOME (previously panicked, exit 101)
  • corgea skill show | head exits quietly rather than panicking on EPIPE
  • install corgea --local writes the identical file with no token set
  • install some-other-skill --local and install corgea@1.2.3 --local both exit 1 with a clear message
  • Registry install without --local still hits the auth gate and the registry

Made with Cursor

Linear ticket: Ship CLI-pinned Corgea skill and synchronize public skills/docs releases

leenk7991 and others added 2 commits August 10, 2026 15:40
An agent reading the skill from a branch or a registry can be told about
flags the installed CLI does not accept. Compiling skills/corgea/SKILL.md
into the binary makes the reference pinned to the version being driven,
by construction.

corgea skill show prints it verbatim. It is dispatched without the token
check that guards install, because reading a compiled-in string cannot
need a login, and the point is that it still answers when the registry
does not.

install --local writes the same content, refusing a name other than
corgea or an explicit version since neither is something the binary can
honour. The registry path is unchanged and still serves company-authored
skills.

Co-authored-by: Cursor <cursoragent@cursor.com>
Config::load() creates ~/.corgea/config.toml and panics when it cannot,
so `corgea skill show` exited 101 with a backtrace in a sandbox with a
read-only home. That is the environment the command is most useful in,
and printing a string compiled into the binary should not depend on the
filesystem, so it is now dispatched before the config loads.

Writing via write_all also lets `corgea skill show | head` exit quietly.
Rust ignores SIGPIPE, so print! would have panicked once the skill grew
past the pipe buffer.

Also anchors the frontmatter test to the frontmatter block rather than
matching anywhere in the file.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread src/skill.rs
Comment thread src/main.rs Outdated

@corgea-security corgea-security left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review risk: 3/5.

The embedded display path is robust, but local installation still unnecessarily depends on a writable HOME. Process-level guarantees also lack integration coverage.

Critical or high-priority changes must be addressed.

Automatic approval was not submitted: automated review found critical or high-priority findings.

@corgea-security corgea-security added the dennis-reviewed Dennis completed an automated review label Aug 10, 2026
The early return added for `skill show` only covered that one command, so
`skill install corgea --local --dir <writable-dir>` still reached the
unconditional `Config::load()` and panicked creating ~/.corgea/config.toml.
The embedded path needs neither a registry nor a token, so the local
installer was unusable in the same sandbox `skill show` was fixed for.

Replace the special case with one rule: `Config::load_or_defaults()` falls
back to in-memory defaults, and `tolerates_unusable_home` decides which
commands get it. Only the two that serve the compiled-in skill qualify;
everything else still fails loudly, because it needs a token or somewhere
to save one.

The existing tests only read the embedded constant, so they survived every
regression this PR guards against. Add binary-level tests that drive the
real executable with no token under an unusable HOME and compare the bytes
it prints and writes against skills/corgea/SKILL.md. Reverting the config
guard fails four of them; removing the --local auth bypass fails five.
Comment thread src/config.rs Outdated
Comment thread src/main.rs

@corgea-security corgea-security left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review risk: 3/5.

The offline commands are well tested for an uncreatable HOME, but config loading still panics on malformed configuration and mutates fresh homes. Both contradict the core no-config/no-persistence behavior.

Critical or high-priority changes must be addressed.

Automatic approval was not submitted: automated review found critical or high-priority findings.

`load_or_defaults` called `load()`, which creates ~/.corgea and writes
config.toml as a side effect of resolving its path. So `skill show` began
persisting state on a writable home -- a regression against the early return
it replaced, and a contradiction of its own comment. It also inherited the
`.expect()` on the TOML parse, so a config the user had merely mistyped took
down the commands that exist to work when nothing else does.

Read the file directly instead, through a `config_path_readonly` that creates
nothing, falling back to the defaults when it is absent, unreadable or
unparseable. `load()` now returns a parse failure as an `io::Error` naming the
file rather than panicking, and `main` prints that and exits 1: a file the
user can edit is their problem to fix, not a crash with a backtrace note.

The tolerance is scoped to the embedded path. A command that needs the config
still refuses to run on one it cannot parse.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dennis-reviewed Dennis completed an automated review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants